package com.adf.admin.controller;

import com.adf.admin.entity.SysUser;
import com.adf.admin.mapper.SysUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class UserController {
    @Autowired
    private SysUserMapper userMapper;

    @GetMapping("dotest")
    public String doTest(){

        StringBuilder sbInfo = new StringBuilder();
        List<SysUser> userList = userMapper.selectList(null);


        //得到一条信息

        SysUser user1 = userMapper.selectById("1");
        System.out.println("当前用户名是:".concat(user1.getName()));

        if(userList != null)
        {
            for(SysUser user : userList){
                sbInfo.append(user.getName());
            }
        }
        else{
            sbInfo.append("无学员信息");
        }

        return sbInfo.toString();
    }
}
